package locations.actions;

import locations.dao.implement.PacientDAOHibernateJPA;
import locations.model.HistoriaSocial;
import locations.model.Pacient;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class NewFichaSocial1Action extends ActionSupport {

	private static final long serialVersionUID = 1L;
	private String id;
	private HistoriaSocial historiaSocial;
  private static String[] staticLanguages = {
      "Actionscript (Flash)",
      "ABAP Objects",
      "Ada",
      "Aleph",
      "AppleScript",
      "Beta",
      "BlitzMax",
      "Boo",
      "C++",
      "XOTcl",
      "Zonnon" };

  private String[] languages = NewFichaSocial1Action.staticLanguages;

  @Override
	public String execute() {
		PacientDAOHibernateJPA d = new PacientDAOHibernateJPA();

		Pacient p = d.retrieveById(Long.parseLong(this.getId()));
		historiaSocial = p.getHistoriaSocial();

		ActionContext.getContext().getSession()
				.put("fichaSocial", historiaSocial);
		return SUCCESS;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public HistoriaSocial getHistoriaSocial() {
		return historiaSocial;
	}

	public void setHistoriaSocial(HistoriaSocial historiaSocial) {
		this.historiaSocial = historiaSocial;
	}

    public String[] getLanguages()
  {
    return languages;
  }

}
